%LS_STEP --- performs a step of Least Squares (LS) algorithm
% theta: m x 1 vector
% P: m x m matrix (symmetric)
% phi: m x 1 vector 
% y: scalar
function [theta_new,P_new,err_new,err_last]=LS_step(theta,P,phi,y)
err_last=y-theta'*phi;
a=1/(1+phi'*P*phi);
theta_new=theta+a*P*phi*err_last;
P_new=P-a*P*phi*phi'*P;
err_new=y-theta_new'*phi;
